-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Fish's completions #212
Conversation
Thanks! Two small issues I had when trying this:
|
Only the token under the cursor is searched, see reasons below.
That's just how tab completion works. You can't expect it to change anything else than the current token. It's also why it doesn't take any other token into consideration, which just won't make sense. If people do want to search with multiple tokens, they should use |
I understand that, but IMO completions should never result in a command that is invalid, which is what's happening here. Btw, merging this PR might take a while - I want to try a couple of different solutions to see what works best. |
You can easily reproduce the same issue with regular To achieve what you expect, every completion needs to implement a full-fledged parser, which is obviously not practical. Technically we can prevent providing completion if the user is completing a second argument, for this issue only though. But IMO that's just unnecessary. |
9806b67
to
d74cd96
Compare
2a5c8ca
to
9ff8993
Compare
@kidonng if you have time, do take a look at #257. I've only implemented Bash completions at the moment, but I'd love to know what you think:
If it works well, we can hopefully write completions for other shells in line with this. |
866e54b
to
bc89589
Compare
Hey @kidonng, I've updated the PR. This is what the new completion function does:
I'd appreciate any thoughts on this. |
This PR brings two improvements to Fish's completions, when completing
{{cmd}}
:Let Fish only complete directories and excludes files
If there is no match in the current directory, Fish will query zoxide with current token and serve them as completions:
This is approximately the same as using
zoxide query -i <current token>
, but more integrated with Fish.Let me know if you have any suggestion over these two changes.